This folder is the publishable version of the residential deconstruction evaluation which is used for the final DEQ report. 

The project was built using:

R version 3.5.0 (2018-04-23) -- "Joy in Playing";
RStudio Version 1.1.453  2009-2018 RStudio, Inc.;

and the following packages (all updated as of June 4, 2018)

	"corrplot", "fBasics", "ggpubr", "ggrepel", "ggthemes", "grDevices", "knitr", "rebus", "scales", "tidyverse"



In order to recreate the project:

read/render the .Rmd files in numerical order. Files needed for each markdown document are either contained in the data folder or are generated by the successive markdown documents and stored in the intermediary folder. All results are stored in the output folder with data visualization objects stored in the graphs folder.

1- Begin by opening RStudio, load the deconstruction R project file, 
2- then open the first .Rmd file. 
3- If you just want final results
	Click the down arrow next to the "Run" button in the (typically) top-left editor pane and select "Restart R and Run All Chunks".
   If you want a printable page output from any file
	Click the "Knit" button ("Knit to HTML" is the default)
4- Repeat this step for each .Rmd file in order.
 


The following list details the file production and use order for each Markdown document: 
		*   indicates external file provided either by DEQ or the user located in the "data" folder;
		**  indicates file generated by the R Markdown notebook series 
			typically located in the "intermediary" folder, 
			report output are located in the "output" folder, and
			graphics and data visualizations are located in the "graph" folder
		

01_decon_material_weight_conversion.Rmd
	uses: 
		*  data/input_file_example.png
		*  data/public_use_raw_data_summary.csv (or equivalent data file from deconstruction projects)
	produces:
		** output/default_material_dimensions.csv (for reference only)
		** intermediary/weight_calc.csv	(for QA/QC purposes)
		** output/missing_quantity_data.csv (for reference only)
		** output/missing_deconMaterialName.csv (for reference or reporting)
		** intermediary/decon_material_weight.csv

02_decon_data_prep.Rmd
	uses:
		*  data/project_workflow.png
		*  data/LCA impact data for Decon Tool.csv
		*  data/EOL.csv
		** intermediary/decon_material_weight.csv
	produces:
		** intermediary/house_weight.csv
		** intermediary/deconMaterialName_SimpleEOLname_mapping.csv (for reference only)
		** intermediary/deconData.csv
		** intermediary/project_material_weight_sum.csv	(for reference only)
		** intermediary/demoData.csv

03_transport.Rmd
	uses:
		*  data/TransportRoutes.csv
		** intermediary/house_weight.csv
		** intermediary/deconMaterialName_SimpleEOLname_mapping.csv
		** intermediary/dropbox_EOL_weight_composition.csv
		** intermediary/deconData.csv
		** intermediary/demoData.csv
	produces:
		** intermediary/per_project_worker_equipment_transport_impacts.csv
		** intermediary/dropbox_EOL_transport_impacts.csv (for reference only)
		** intermediary/final_deconstruction_scenario_with_transport.csv
		** intermediary/final_demolition_scenario_with_transport.csv

04_decon_data_analysis.Rmd
	uses:
		*  data/project_workflow.png
		** intermediary/house_weight.csv
		** intermediary/per_project_worker_equipment_transport_impacts.csv
		** intermediary/final_deconstruction_scenario_with_transport.csv
		** intermediary/final_demolition_scenario_with_transport.csv
	produces:
		** intermediary/final_complete_data_all_scenario_impacts.csv
		** intermediary/final_impact_summary.csv
		** output/carbon_impact_breakdown.csv
		** output/energy_impact_breakdown.csv

05_deconstruction_final_report
	uses:
		*  data/data_description_sheet.csv
		** intermediary/house_weight.csv
		** intermediary/final_impact_summary.csv
		** intermediary/decon_material_weight.csv
		** intermediary/final_complete_data_all_scenario_impacts.csv
	produces:
		** graphs/pie_salvage_dropbox.png
		** graphs/salvage_by_material.png
		** graphs/dropbox_by_material_type.png
		** graphs/carbon_bar_impact.png
		** graphs/energy_bar_impact.png
		** graphs/carbon_by_activity.png
		** graphs/energy_by_activity.png
		** graphs/carbon_by_material_type.png
		** graphs/energy_by_material_type.png
		** graphs/carbon_wood.png
		** graphs/energy_wood.png
		** graphs/carbon_mo.png
		** graphs/energy_mo.png
		** graphs/ratio_salvage_dropbox.png
		** graphs/salvage_by_house_size.png
		** graphs/salvage_by_house_age.png


NOTE: The biggest vulnerability to reproducibility is the use of index numbers instead of names inside of data frame select and filter function calls, (its a trade off for saving time in the coding and specifying selections by name) which exposes the projects to erroneous output if the input file structures change in any way (columns are reordered or names change). Changing this approach and using names leaves the scripts vulnerable to name changes to the original excel files,  so index numbers were chosen to save time and to avoid risk of spelling errors in the data frame.